import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

class ItemQuickMenu extends StatelessWidget {
  final String imagePath;
  final String text;
  final Color? tintColor;
  final double? height;
  final double? width;
  final GestureTapCallback? onTap;

  const ItemQuickMenu({
    Key? key,
    required this.imagePath,
    required this.text,
    this.onTap,
    this.tintColor,
    this.height,
    this.width,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Container(
        height: height,
        width: width,
        color: Colors.white,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            imagePath.startsWith('http')
                ? CachedNetworkImage(
                    imageUrl: imagePath,
                    width: 30,
                    color: tintColor ?? Theme.of(context).primaryColor,
                  )
                : Image.asset(
                    imagePath,
                    width: 30,
                    color: tintColor ?? Theme.of(context).primaryColor,
                  ),
            Container(
              child: Text(text),
              margin: EdgeInsets.only(top: 5),
            ),
          ],
        ),
      ),
    );
  }
}
